package com.qf.controller;


import com.qf.pojo.BaseResp;
import com.qf.pojo.vo.Order;
import com.qf.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    //提交购物车
    OrderService orderService;
    @RequestMapping("/submit")
    public BaseResp submit(@RequestBody Order order){
       return orderService.submit(order);
    }
    //查询所有订单
    @RequestMapping("/findAll/{page}/{size}")
    public BaseResp findAll(@PathVariable("page")Integer page , @PathVariable("size")Integer size){
        return orderService.findAll(page,size);
    }
    //删除订单
    @RequestMapping("del")
    public BaseResp del(@RequestBody Map map){
        return orderService.del(Integer.valueOf(map.get("oid").toString()));
    }
}
